import { http } from '@/utils/http'
import { TokenVO, LoginBody } from './login.d'
import { RegisterDto } from './register'
export const login = (data: LoginBody) => {
  return http<TokenVO>({
    url: `/customer/login`,
    method: 'POST',
    data,
  })
}

export const getEmailCode = (email: string) => {
  return http<boolean>({
    url: `/customer/emailCode`,
    method: 'GET',
    query: { email },
  })
}
export const checkEmailCode = (email: string, code: string) => {
  return http<boolean>({
    url: `/customer/checkEmail/Code`,
    method: 'GET',
    query: { email, code },
  })
}
export const getAppUserInfo = () => {
  return http<IUserInfo>({
    url: `/customer/getUserInfo`,
    method: 'GET',
  })
}

export const register = (data: RegisterDto) => {
  return http<boolean>({
    url: `/customer/register`,
    method: 'POST',
    data,
  })
}
